import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class TableTest {
	Table table=new Table();
	String [] tab;
	@Before
	public void setUp() {
		tab=table.ID;
	}
	@Test
	public void testCreateID() {
		table.createID(6);
		int a=tab.length;
		int b=table.ID.length;
		assertEquals(a,b);
	}

	@Test
	public void testGetID() {
		String id1=table.getID();
		assertEquals("PL1",id1);
		String id2=table.getID();
		assertEquals("PL2",id2);
		String id3=table.getID();
		assertEquals("PL3",id3);
		String id4=table.getID();
		assertEquals("PL4",id4);
		String id5=table.getID();
		assertEquals("PL5",id5);
		String id6=table.getID();
		assertEquals("PL6",id6);
		String id7=table.getID();
		assertEquals("Brak Miejsc",id7);
	}

	@Test
	public void testHierarchy() {
		table.createID(3);
		String set1="2d As 2h 3c";
		String set2="2c 2s Kh Jd";
		String set3="Ac Kc 7c 4c";
		String [][] hierarch={{"As","2d","x","3c"},{"2c", "x", "Jd","Kh"},{"Ac", "x", "x", "x"}};
		table.hierarchy(set1);
		table.hierarchy(set2);
		table.hierarchy(set3);
		assertFalse(hierarch==table.check);
	}

	@Test
	public void testSort() {
		table.createID(3);
		String pl1=table.getID();
		String pl2=table.getID();
		String pl3=table.getID();
		assertNotSame(pl1,pl2,pl3);
		
		String set1="2d As 2h 3c";
		String set2="2c 2s Kh Jd";
		String set3="Ac Kc 7c 4c";
		table.hierarchy(set1);
		table.hierarchy(set2);
		table.hierarchy(set3);
		String [][] help=table.sort(table.check);
		String [][] sorted={{"As","2d","3c","x"},{"2c","Jd","Kh","x"},{"Ac","x","x","x"}};
		assertNotSame(sorted,help);
	}
	@After
	public void tearDown() {
		table=null;
	}

}
